/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mahumLogs.beans;

import com.mahumLogs.backedbeans.Administrateur;
import com.mahumLogs.backedbeans.Etudiant;
import java.io.Serializable;
import javax.annotation.Resource;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;

/**
 *
 * @author Adrien
 */
@Named
@SessionScoped
public class SessionBean implements Serializable {

    @PersistenceContext
    private EntityManager em;
    @Resource
    private UserTransaction tx;

    private Etudiant etudiant;
    private Boolean isLogged;
    private Administrateur admin;
    private String lastUrlVisited;

    /**
     * Constructeur
     */
    public SessionBean() {
        isLogged = false;
        lastUrlVisited = "/";
    }

    /**
     * @return em
     */
    public EntityManager getEm() {
        return em;
    }

    /**
     * @return admin 
     */
    public Administrateur getAdmin() {
        return admin;
    }

    /**
     * @param admin 
     */
    public void setAdmin(Administrateur admin) {
        this.admin = admin;
    }

    /**
     * @param em 
     */
    public void setEm(EntityManager em) {
        this.em = em;
    }

    /**
     * @return 
     */
    public UserTransaction getTx() {
        return tx;
    }

    /**
     * @param tx 
     */
    public void setTx(UserTransaction tx) {
        this.tx = tx;
    }

    /**
     * @return 
     */
    public Etudiant getEtudiant() {
        return etudiant;
    }

    /**
     * @param etudiant 
     */
    public void setEtudiant(Etudiant etudiant) {
        this.etudiant = etudiant;
    }

    /**
     * @return 
     */
    public Boolean isIsLogged() {
        return isLogged;
    }

    /**
     * @param isLogged 
     */
    public void setIsLogged(Boolean isLogged) {
        this.isLogged = isLogged;
    }

    public String getLastUrlVisited() {
        return lastUrlVisited;
    }

    public void setLastUrlVisited(String lastUrlVisited) {
        this.lastUrlVisited = lastUrlVisited;
    }
}
